<!--#include file="functions.asp" -->

<%
  dim vendName

  
  sql="SELECT EMPCODE, FIRSTNAME, LASTNAME, DEPARTMENT FROM EMP WHERE EMPCODE='" & request.querystring("src") &"'"
  set rs=cn.execute(sql)
  
  if rs.eof then
%>
<SCRIPT language="JavaScript">
	window.opener.<%= request.querystring("fld")%>.value='';
	window.opener.<%= request.querystring("fld2")%>.value='';
	var url_source="error_msg.html";
	var arg="Employee Not Found !!";
	var modal_dim="dialogWidth:360px; dialogHeight:160px; center:yes; status:no; location:no;";
	var x = window.showModalDialog(url_source,arg,modal_dim);
	window.opener.<%= request.querystring("src")%>.focus();
	window.opener.<%= request.querystring("src")%>.select();
	window.close();
</SCRIPT> 


<%
  else
  Do While Not rs.EOF
  empName=rs("FIRSTNAME")& " " & rs("LASTNAME")
  dept=rs("DEPARTMENT")
  rs.MoveNext
  Loop
  
  Set rs = Nothing
%>
<SCRIPT language="JavaScript">
var querystring = '<%= request.querystring("fld")%>' ;

window.opener.<%= request.querystring("fld")%>.value='<%= empName %>';
//window.opener.<%= request.querystring("fld2")%>.value='<%= dept %>';
window.opener.<%= request.querystring("fld")%>.focus();
window.close();

</SCRIPT>
<% end if %>

